package com.rocsun.order.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @program: rocsun-cloud-alibaba
 * @description:
 * @author: yx.guo
 * @create: 2025-08-28 11:13
 **/
@Configuration
public class RestTemplateConfig {


    /**
     * 基于注解的方式调用的实际不实用ip和端口，而是使用《服务名 http://service-product/product/{id}》请求
     * @return
     */
    @LoadBalanced // 注解式负载均衡
    @Bean(name = "restTemplate")
    public RestTemplate restTemplate() {
       return new RestTemplate();
    }

}
